home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / COM / LineShare 3.3.1 folder.sit / LineShare 3.3.1 folder / LineShare 3.3.1 / LineShare Scripts / Supra Fax1&ARA&Data < prev    next >
Text File  |  1995-06-06  |  9KB  |  430 lines

  1. ! Version 3.1.3
  2. !
  3. !$ Use this script with Supra modems (up to V.34)
  4. !$ Supports: fax, ARA and regular data incoming calls.
  5. !
  6. !$ Make sure that *Class 1* fax software is installed
  7. !
  8. !$ A cable for hardware handshaking is required
  9.  
  10. ^2 Speaker On:        = Enum("Never" = "0","During Connect" = "1", "Always"="2") "1"
  11. ^3 Speaker Volume:       = Enum("Low"="1","Medium"="2","High"="3") "2"
  12. ^4 Answer On:         = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
  13. ^5 Port Speed:        = Enum("9600","19200","38400","57600") "19200"
  14. ^6 Handshake wires:   = Bool("Both"="&D0","CTS only"="&D2") "&D2"
  15. ^7 Fax Port Speed:      = Enum("Fixed (14.4 modems)"="F","Auto (28.8 modems)"="V") "F"
  16. ^8 Error Correction:  = Bool("Disabled"="&Q6","Enabled"="&Q5") "&Q6"
  17. ! ------------------------------------------
  18. ! Resetting the modem:
  19. ! ------------------------------------------
  20. @Hangup
  21.   SetTries 2
  22.   Flush
  23.   HsReset 0,0,17,19,0,0
  24.   DtrSet
  25. !
  26. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  27. ! to enter the command mode
  28. !
  29. @Label 1
  30.   matchclr
  31.   matchstr 1 2 "OK¥r¥n"
  32.   write "ATH0&F1¥r"
  33.   matchread 20
  34.   ChrDelay 1
  35.   Write "+++"
  36.   ChrDelay 0
  37.   DtrClear
  38.   SBreak
  39.   DtrSet
  40. !
  41.   DecTries
  42.   IfTries 0 1
  43. !
  44. ! OSErr -6019 "Modem error - the modem is not responding"
  45. !
  46.   exit -6019
  47. @Label 2
  48.   write "AT+FCLASS=0¥r"
  49.   Jsr 100
  50.   write "AT+FAE=0¥r"
  51.   Jsr 100
  52.   exit 0
  53.  
  54. ! ------------------------------------------
  55. !    Receiving incoming calls
  56. ! ------------------------------------------
  57. @ANSWER
  58. !
  59. ! Set the modem preferred speed first
  60. !
  61.   SerReset Val("^5"),0,8,1
  62.   Jsr 80
  63.  
  64. @Label 10
  65. !
  66. ! Set the common options
  67.   Jsr 70
  68. !
  69. ! Set the communication options:
  70. ! ・ &Q6/Q5: Error connection 
  71. ! ・ &K3: HW flow control       (for ARA, Fax should not use a handshake on receiving)
  72. ! ・ W1:  report connection speed
  73. !
  74.   Write "AT^8&K3W1¥r"
  75.   Jsr 100
  76. !
  77. ! Set Fax mode
  78. !
  79.   Write "AT+FCLASS=1¥r"
  80.   Jsr 100
  81.   Write "AT+FAE=1¥r"
  82.   Jsr 100
  83. !
  84. ! It's for Rockwell ONLY! Set FCLASS to 0 again - otherwise,
  85. ! it cannot accept data calls
  86. !
  87.   Write "AT+FCLASS=0¥r"
  88.   Jsr 100
  89. !
  90. ! Tell the modem to determine the type of the incoming call
  91. ! Fetch the tube after ^4 rings
  92. !
  93.   Write "ATS0=^4V0¥r"
  94.   Jsr 110
  95. !
  96. ! Everything is ready - let's sit and wait for a call
  97. ! We'll wait for 2 minutes, then reinitiate the modem
  98. !
  99.   Note "Waiting for a fax/ARA/data callノ"
  100.   MatchClr
  101.   matchstr 02 40 "47¥r"
  102.   MatchStr 03 41 "48¥r"
  103.   MatchStr 04 42 "49¥r"
  104.   MatchStr 05 43 "50¥r"
  105.   MatchStr 06 44 "51¥r"
  106.   MatchStr 07 45 "52¥r"
  107.   MatchStr 08 46 "53¥r"
  108.   MatchStr 09 47 "54¥r"
  109.   MatchStr 10 48 "55¥r"
  110.   MatchStr 11 49 "56¥r"
  111.   MatchStr 12 50 "57¥r"
  112.   MatchStr 13 51 "58¥r"
  113.  
  114.   MatchStr 14 45 "95¥r"
  115.   MatchStr 15 46 "96¥r"
  116.   MatchStr 16 47 "97¥r"
  117.   MatchStr 17 48 "98¥r"
  118.   MatchStr 18 49 "99¥r"
  119.   MatchStr 19 50 "100¥r"
  120.   MatchStr 20 51 "101¥r"
  121.  
  122.   MatchStr 25 19 "33¥r"
  123.   matchstr 26 18 "2¥r"
  124.   matchstr 27 57 "1¥r"
  125.   matchstr 28 17 "3¥r"
  126.   matchstr 29 17 "8¥r"
  127.   matchstr 30 17 "7¥r"
  128. @Label 16
  129.   Matchread 1200
  130. @Label 17
  131.   Note "Tuning againノ"
  132.   Write "ATV1¥r"
  133.   Jsr 100
  134.   Jump 10
  135. @Label 18
  136.   Note "Ringノ"
  137.   Jump 16
  138. @Label 19
  139.   Note "Fax tones detectedノ"
  140.   IfStr 7 16 "V"
  141.   SetSpeed 19200
  142.   Jump 16
  143.  
  144. !
  145. ! Data connection has been established (we read "CONNECT")
  146. ! Put the "CONNECT" back to the buffer and attach the "Data" subPort
  147. ! if it was an incoming call, put the "RING" before the "CONNECT"
  148. !
  149. @Label 20
  150.   IfOpen "Data" 21
  151.   Jump 30
  152. @Label 21
  153.   IfOpen "ARA" 22
  154.   Jump 35
  155. @Label 22
  156.   Note "Waiting for an ARA frame"
  157.   MatchClr
  158. ! MatchStr 1 23 "^$¥r"    6/6/95: there are messages like 70¥r still in the buffer.
  159.   MatchStr 2 28 "¥08¥01¥03¥14¥04¥03¥00¥08¥250¥16¥03"
  160.   MatchStr 3 29 "¥01¥27¥02¥29¥01¥02¥01¥06"
  161.   MatchRead 60
  162.   Jump 24
  163. @Label 23
  164.   QueueInput "^$¥r"
  165. @Label 24
  166.   Note "Non-ARA call"
  167.   Jump 35
  168.  
  169. @Label 28
  170.   Note "ARA 1.0 call"
  171.   Jump 30
  172. @Label 29
  173.   Note "ARA 2.0 call"
  174.   Jump 30
  175.  
  176. @Label 30
  177.   QueueInput "¥r¥nCARRIER ^B¥r¥n"  
  178.   QueueInput "¥r¥nRING¥r¥n"
  179.   Attach "ARA" (DTR)
  180.  
  181. @Label 35
  182.   GetSReg C "DATA" 4
  183.   QueueInput "¥r^CCONNECT ^B¥r^C"
  184.   ifOriginate 36
  185.   QueueInput "¥r^CRING¥r^C"
  186. @Label 36
  187.   Attach "Data" (DTR,Escape,Break)
  188.  
  189.  
  190. !
  191. ! Converting numeric responses into the verbal
  192. !
  193. @Label 40
  194.   SetVar B "2400"
  195.   Jump 20
  196. @Label 41
  197.   SetVar B "4800"
  198.   Jump 20
  199. @Label 42
  200.   SetVar B "7200"
  201.   Jump 20
  202. @Label 43
  203.   SetVar B "9600"
  204.   Jump 20
  205. @Label 44
  206.   SetVar B "12000"
  207.   Jump 20
  208. @Label 45
  209.   SetVar B "14400"
  210.   Jump 20
  211. @Label 46
  212.   SetVar B "16800"
  213.   Jump 20
  214. @Label 47
  215.   SetVar B "19200"
  216.   Jump 20
  217. @Label 48
  218.   SetVar B "21600"
  219.   Jump 20
  220. @Label 49
  221.   SetVar B "24000"
  222.   Jump 20
  223. @Label 50
  224.   SetVar B "26400"
  225.   Jump 20
  226. @Label 51
  227.   SetVar B "28800"
  228.   Jump 20
  229.  
  230. ! ------------------------------------------
  231. ! Originating a call through the "ARA" subport
  232. ! ------------------------------------------
  233. @ORIGINATE "ARA"
  234.   SerReset Val("^5"),0,8,1
  235.   Jsr 80
  236. !
  237. ! Set the common options
  238. !
  239.   Jsr 70
  240. !
  241. ! Set the Data mode:
  242. ! ・ &Q6:Normal connection (no compression, correction - for ARA)
  243. ! ・ &K3: HW Handshake
  244. ! ・ハS7:  time-out (90 sec) for long-distance calls
  245. ! ・ W1:  report connection rate
  246. !
  247.   Write "AT&Q6&K3S7=90W1¥r"
  248.   Jsr 100
  249. !
  250. ! Emit the ARA script commands ("Xnn")
  251.   Jsr 60
  252. !
  253. ! Prepare to receive all error result codes, dial the number
  254. !
  255.   Jsr 90
  256.   MatchStr 1 55 "¥r¥nCARRIER ^$¥r¥n"
  257.   MatchStr 2 55 "¥r¥nCARRIER ^$/VFC¥r¥n"
  258.   MatchRead 1000
  259.   Write "¥r"
  260.   Exit -6019
  261. @Label 55
  262.   QueueInput "¥r¥nCARRIER ^$¥r¥n"
  263.   Attach "ARA" (DTR)
  264.  
  265. ! ------------------------------------------
  266. ! Originating a call through the "DATA" subport
  267. ! ------------------------------------------
  268. @ORIGINATE "Data"
  269.   SerReset Val("^5"),0,8,1
  270.   Jsr 80
  271. !
  272. ! Set the common options
  273. !
  274.   Jsr 70
  275. !
  276. ! Set the Data mode:
  277. ! ・ ¥N3: Auto-reliable
  278. ! ・ &K3: HW Handshake
  279. ! ・ハS7:  time-out (90 sec) for long-distance calls
  280. !
  281.   Write "AT&K3S7=90¥r"
  282.   Jsr 100
  283. !
  284. ! Emit the Data commands
  285.   Jsr 60
  286. !
  287. ! Prepare to receive all error result codes, dial the number
  288. !
  289.   Jsr 90
  290.   MatchStr 1 56 "¥r¥nCONNECT "
  291.   MatchRead 1000
  292.   Write "¥r"
  293.   Exit -6019
  294. @Label 56
  295.   QueueInput "¥r¥nCONNECT "
  296.   Attach "Data" (DTR,Escape,Break)
  297.  
  298. ! ------------------------------------------
  299. ! Originating a call through the "Fax" subPort
  300. ! ------------------------------------------
  301. @ORIGINATE "Fax"
  302. !
  303. ! Set the "Fax" speed
  304. !
  305.   SerReset 19200,0,8,1
  306.   Jsr 80
  307. !
  308. ! Set the common options
  309. !
  310.   Jsr 70
  311. !
  312. ! Set the Fax mode
  313. ! &K4: Xon/Xoff handshake
  314. !
  315.   Write "AT&K4+FCLASS=1¥r"
  316.   Jsr 100
  317. !
  318. ! Now emit all commands that the application has sent to that port,
  319. ! except "FCLASS", etc
  320. !
  321.   EmitClear "+FCLASS","V","E"
  322.   Jsr 60
  323.   Write "ATV0¥r"
  324.   Jsr 110
  325. !
  326. ! Prepare to receive all error result codes, dial the number
  327. !
  328.   MatchClr
  329.   MatchStr 01 57 "1¥r"
  330.   MatchStr 13 93 "3¥r"
  331.   MatchStr 14 94 "8¥r"
  332.   MatchStr 15 92 "7¥r"
  333.   Write "ATD^1¥r"
  334.   HsReset *
  335.   MatchRead 900
  336.   Write "¥r"
  337.   Exit -6019
  338.  
  339. !
  340. ! Fax connection has been established (we read "FAX")
  341. ! Put the +FCON back to the buffer,
  342. ! if it was an incoming call, put the "RING" before the "+FCON"
  343. ! Attach the "Fax" subPort
  344. !
  345. @Label 57
  346.   QueueInput "1¥r"
  347.   IfStr 7 58 "V"
  348.   SetSpeed 19200
  349. @Label 58
  350.   ifOriginate 59
  351.   QueueInput "2¥r2¥r"
  352. @Label 59
  353.   Attach "Fax" (Reset(2400),IdleLimit=30)
  354.  
  355. !
  356. ! This section emits all modem commands sent from the client application
  357. ! For each set of commands the "OK" answer is awaited
  358. !
  359. @Label 60
  360.   EmitStart
  361. @Label 61
  362.   EmitCommand 62
  363.   Jsr 100
  364.   Jump 61
  365. @Label 62
  366.   return
  367. !
  368. ! This section initiates the modem before ANSWER and ORIGINATEs:
  369. ! extended responses + connect at the highest rate + speaker control +
  370. ! reset on Dtr drop + DCD valid
  371. ! Verbal responses mode, no echo 
  372. !
  373. @Label 70
  374.   Write "ATX4N1M^2L^3^6&C1V1E0¥r"
  375.   Jsr 100
  376.   return 
  377.  
  378. !
  379. ! This section syncronize the modem after the serial port speed switching
  380. !
  381. @Label 80
  382.   ChrDelay 1
  383.   Write "AT¥r"
  384.   ChrDelay 0
  385.   Jsr 100
  386.   return
  387. !
  388. ! Prepare to receive error result codes, send the dialing command and
  389. ! set the user's handshake mode
  390. !
  391. @Label 90
  392.   MatchClr
  393.   MatchStr 2 91 "NO DIALTONE¥r¥n"
  394.   MatchStr 3 92 "BUSY¥r¥n"
  395.   MatchStr 4 93 "NO CARRIER¥r¥n"
  396.   MatchStr 5 94 "NO ANSWER¥r¥n"
  397.   Write "ATD^1¥r"
  398.   HsReset *
  399.   return
  400. @Label 91
  401.   exit -6020
  402. @Label 92
  403.   exit -6022
  404. @Label 93
  405.   exit -6021
  406. @Label 94
  407.   exit -6023
  408. !
  409. ! Processing the AT command:
  410. ! OK -> proceed
  411. ! ERROR or TimeOut ->exit -6019
  412. ! It can be called AFTER the "Write" command, since LineShare buffers input
  413. !
  414. @Label 100
  415.   MatchClr
  416.   MatchStr 1 103 "¥r¥nOK¥r¥n"
  417.   MatchStr 2 102 "¥r¥nERROR¥r¥n"
  418. @Label 101
  419.   MatchRead 20
  420. @Label 102
  421.   Exit -6019
  422. @Label 103
  423.   return
  424.  
  425. @Label 110
  426.   MatchClr
  427.   MatchStr 1 103 "0¥r"
  428.   MatchStr 2 102 "4¥r"
  429.   Jump 101
  430.